Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QOLDEV-833 add template to stand up instances for generating golden AMIs #540

Merged
merged 13 commits into from
Nov 12, 2024

Conversation

ThrawnCA
Copy link
Contributor

No description provided.

@ThrawnCA ThrawnCA requested a review from a team May 17, 2024 05:57
* - 'setup': Full end-to-end configuration, from vanilla operating system to live instance.
* - 'deploy': Take a vanilla operating system and set up a warm instance, but do not make it active.
* - 'configure': Take a warm instance and make it active.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when i see the options of
setup, deploy, configure.

I do not envision 'setup' doing everything. nor 'deploy' only making a 'warm' instance.

@chris-randall-qol and others, what is your thoughts on this.

I know this is from legacy deployPhase's we got from inheriting this codebase but i think its time to make it less confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is from legacy deployPhase's we got from inheriting this codebase

Yes, those were the OpsWorks terms. We could change them, it would just mean a lot of renaming.

Note that the distinction between 'deploy' and 'configure' creating warm vs hot instances did not come from OpsWorks. It's just something that I've observed to be useful if we want to make custom images.

@duttonw
Copy link
Member

duttonw commented Nov 11, 2024

its coming together, so now we can boot up a blank server and get it python installed etc. we now need in ansible to take ami it and then set paramstore of the ami it made so that it can be picked up and injected into the asg groups in the next step for ensuing new instances are using 'current' for quick boot times.

ie. heres some pseudo code that is the direction i'd think it could go. (your welcome to go another direction)

#-- need to do a for loop for the 3 types and this pseudo code is for latest ansible:

- name: Get EC2 instance details
      amazon.aws.ec2_instance_info:
        instance_ids: "{{ instance_id }}"
      register: instance_info

    - name: Verify instance exists
      assert:
        that: instance_info.instances | length > 0
        msg: "Instance not found. Check CloudFormation template and stack outputs."

    - name: Create AMI from warm EC2 instance
      amazon.aws.ec2_ami:
        instance_id: "{{ instance_id }}"
        name: "Web|Solr|Batch|PRODWarmInstanceAMI-{{ instance_id }}"
        wait: true
        state: present
        description: "{{ ami_description }} include $DATE"
      register: ami_info

    - name: Store AMI ID in Parameter Store
      amazon.aws.aws_ssm_parameter_store:
        name: "{{ param_name }}"
        value: "{{ ami_info.image_id }}"
        type: String
        overwrite: true
        description: "AMI ID for auto-scaling updates of Web|Solr|Batch"

then in asg cfn template section, do lookup for param and update to use that (else fall back to vanilla)

@ThrawnCA ThrawnCA merged commit 8ff4658 into develop Nov 12, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants